﻿/**
 * 
 */

var screenx =0;
var screeny =0;

var scrx =0;
var scry =0;

//var screenx_old =0;
//var screeny_old =0;

//var SSpace=WALKSTEPD*WALKSTEPCNT*5; //留3个走动格

//var NEED_SCROLLSRC =0;

function scroll(player){
	if (onFight==1){ screenx=0;screeny=0;return}
	/*人物中心算法*/
	screenx = SCREENW/2 -player.abx; 
	screeny = SCREENH/2-player.aby -SPRITH/2;
	
	/*TODO区域适用算法
	m_sx = player.abx - scrx;
	m_sy = player.aby - scry;
	
	if (m_sx>SCREENW-SSpace) scrx=scrx+m_sx-SCREENW+SSpace;
	if (m_sx<SSpace) scrx=scrx-m_sx;

	if (m_sy>SCREENW-SSpace) scry=scry+m_sy-SCREENW+SSpace;
	if (m_sy<SSpace) scry=scry-m_sy;
	
	screenx=-scrx;screeny=scry;*/
}
